.class public Lcom/openfeint/api/ui/Dashboard;
.super Lcom/openfeint/internal/ui/WebNav;
.source "Dashboard.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/openfeint/api/ui/Dashboard$DashboardActionHandler;
    }
.end annotation


# static fields
.field private static sOpenDashboards:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Lcom/openfeint/api/ui/Dashboard;",
            ">;"
        }
    .end annotation
.end field


# instance fields
.field mRootIsHome:Z


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 31
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    sput-object v0, Lcom/openfeint/api/ui/Dashboard;->sOpenDashboards:Ljava/util/List;

    .line 28
    return-void
.end method

.method public constructor <init>()V
    .locals 1

    .prologue
    .line 28
    invoke-direct {p0}, Lcom/openfeint/internal/ui/WebNav;-><init>()V

    .line 30
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/openfeint/api/ui/Dashboard;->mRootIsHome:Z

    .line 28
    return-void
.end method

.method public static close()V
    .locals 3

    .prologue
    .line 47
    sget-object v1, Lcom/openfeint/api/ui/Dashboard;->sOpenDashboards:Ljava/util/List;

    invoke-interface {v1}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v1

    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-nez v2, :cond_0

    .line 50
    return-void

    .line 47
    :cond_0
    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/openfeint/api/ui/Dashboard;

    .line 48
    .local v0, d:Lcom/openfeint/api/ui/Dashboard;
    invoke-virtual {v0}, Lcom/openfeint/api/ui/Dashboard;->finish()V

    goto :goto_0
.end method

.method public static open()V
    .locals 2

    .prologue
    .line 37
    const/4 v0, 0x0

    const/4 v1, 0x0

    invoke-static {v0, v1}, Lcom/openfeint/api/ui/Dashboard;->open(Ljava/lang/String;Z)V

    .line 38
    return-void
.end method

.method private static open(Ljava/lang/String;Z)V
    .locals 7
    .parameter "screenName"
    .parameter "spotlight"

    .prologue
    .line 91
    invoke-static {}, Lcom/openfeint/api/OpenFeint;->trySubmitOfflineData()V

    .line 93
    invoke-static {}, Lcom/openfeint/internal/OpenFeintInternal;->getInstance()Lcom/openfeint/internal/OpenFeintInternal;

    move-result-object v1

    .line 95
    .local v1, ofi:Lcom/openfeint/internal/OpenFeintInternal;
    invoke-virtual {v1}, Lcom/openfeint/internal/OpenFeintInternal;->isFeintServerReachable()Z

    move-result v3

    if-nez v3, :cond_0

    .line 96
    invoke-static {}, Lcom/openfeint/internal/OpenFeintInternal;->getInstance()Lcom/openfeint/internal/OpenFeintInternal;

    move-result-object v3

    invoke-virtual {v3}, Lcom/openfeint/internal/OpenFeintInternal;->getContext()Landroid/content/Context;

    move-result-object v3

    invoke-virtual {v3}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v2

    .line 97
    .local v2, r:Landroid/content/res/Resources;
    const v3, 0x7f040028

    invoke-virtual {v2, v3}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

    move-result-object v3

    .line 98
    const v4, 0x7f040029

    invoke-virtual {v2, v4}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

    move-result-object v4

    .line 99
    sget-object v5, Lcom/openfeint/api/Notification$Category;->Foreground:Lcom/openfeint/api/Notification$Category;

    sget-object v6, Lcom/openfeint/api/Notification$Type;->NetworkOffline:Lcom/openfeint/api/Notification$Type;

    .line 97
    invoke-static {v3, v4, v5, v6}, Lcom/openfeint/internal/notifications/TwoLineNotification;->show(Ljava/lang/String;Ljava/lang/String;Lcom/openfeint/api/Notification$Category;Lcom/openfeint/api/Notification$Type;)V

    .line 107
    .end local v2           #r:Landroid/content/res/Resources;
    :goto_0
    return-void

    .line 103
    :cond_0
    invoke-virtual {v1}, Lcom/openfeint/internal/OpenFeintInternal;->getAnalytics()Lcom/openfeint/internal/Analytics;

    move-result-object v3

    invoke-virtual {v3}, Lcom/openfeint/internal/Analytics;->markDashboardOpen()V

    .line 104
    new-instance v0, Landroid/content/Intent;

    invoke-virtual {v1}, Lcom/openfeint/internal/OpenFeintInternal;->getContext()Landroid/content/Context;

    move-result-object v3

    const-class v4, Lcom/openfeint/api/ui/Dashboard;

    invoke-direct {v0, v3, v4}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 105
    .local v0, intent:Landroid/content/Intent;
    if-eqz p0, :cond_1

    const-string v3, "screenName"

    invoke-virtual {v0, v3, p0}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 106
    :cond_1
    invoke-virtual {v1, v0, p1}, Lcom/openfeint/internal/OpenFeintInternal;->submitIntent(Landroid/content/Intent;Z)V

    goto :goto_0
.end method

.method public static openAchievements()V
    .locals 2

    .prologue
    .line 72
    const-string v0, "achievements"

    const/4 v1, 0x0

    invoke-static {v0, v1}, Lcom/openfeint/api/ui/Dashboard;->open(Ljava/lang/String;Z)V

    .line 73
    return-void
.end method

.method public static openFromSpotlight()V
    .locals 2

    .prologue
    .line 41
    const-string v0, "user.json?spotlight=true"

    const/4 v1, 0x1

    invoke-static {v0, v1}, Lcom/openfeint/api/ui/Dashboard;->open(Ljava/lang/String;Z)V

    .line 42
    return-void
.end method

.method public static openGameDetail(Ljava/lang/String;)V
    .locals 2
    .parameter "appId"

    .prologue
    .line 81
    new-instance v0, Ljava/lang/StringBuilder;

    const-string v1, "game?game_id="

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const/4 v1, 0x0

    invoke-static {v0, v1}, Lcom/openfeint/api/ui/Dashboard;->open(Ljava/lang/String;Z)V

    .line 82
    return-void
.end method

.method public static openLeaderboard(Ljava/lang/String;)V
    .locals 2
    .parameter "leaderboardId"

    .prologue
    .line 65
    new-instance v0, Ljava/lang/StringBuilder;

    const-string v1, "leaderboard?leaderboard_id="

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const/4 v1, 0x0

    invoke-static {v0, v1}, Lcom/openfeint/api/ui/Dashboard;->open(Ljava/lang/String;Z)V

    .line 66
    return-void
.end method

.method public static openLeaderboards()V
    .locals 2

    .prologue
    .line 56
    const-string v0, "leaderboards"

    const/4 v1, 0x0

    invoke-static {v0, v1}, Lcom/openfeint/api/ui/Dashboard;->open(Ljava/lang/String;Z)V

    .line 57
    return-void
.end method


# virtual methods
.method protected createActionHandler(Lcom/openfeint/internal/ui/WebNav;)Lcom/openfeint/internal/ui/WebNav$ActionHandler;
    .locals 1
    .parameter "webNav"

    .prologue
    .line 188
    new-instance v0, Lcom/openfeint/api/ui/Dashboard$DashboardActionHandler;

    invoke-direct {v0, p0, p1}, Lcom/openfeint/api/ui/Dashboard$DashboardActionHandler;-><init>(Lcom/openfeint/api/ui/Dashboard;Lcom/openfeint/internal/ui/WebNav;)V

    return-object v0
.end method

.method protected initialContentPath()Ljava/lang/String;
    .locals 3

    .prologue
    .line 174
    invoke-virtual {p0}, Lcom/openfeint/api/ui/Dashboard;->getIntent()Landroid/content/Intent;

    move-result-object v1

    const-string v2, "screenName"

    invoke-virtual {v1, v2}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 175
    .local v0, screenName:Ljava/lang/String;
    if-eqz v0, :cond_0

    .line 176
    const/4 v1, 0x0

    iput-boolean v1, p0, Lcom/openfeint/api/ui/Dashboard;->mRootIsHome:Z

    .line 177
    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "dashboard/"

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 179
    :goto_0
    return-object v1

    :cond_0
    const-string v1, "dashboard/user"

    goto :goto_0
.end method

.method public onCreateOptionsMenu(Landroid/view/Menu;)Z
    .locals 2
    .parameter "menu"

    .prologue
    .line 131
    invoke-virtual {p0}, Lcom/openfeint/api/ui/Dashboard;->getMenuInflater()Landroid/view/MenuInflater;

    move-result-object v0

    const/high16 v1, 0x7f07

    invoke-virtual {v0, v1, p1}, Landroid/view/MenuInflater;->inflate(ILandroid/view/Menu;)V

    .line 132
    const/4 v0, 0x1

    return v0
.end method

.method public onDestroy()V
    .locals 1

    .prologue
    .line 121
    invoke-super {p0}, Lcom/openfeint/internal/ui/WebNav;->onDestroy()V

    .line 122
    sget-object v0, Lcom/openfeint/api/ui/Dashboard;->sOpenDashboards:Ljava/util/List;

    invoke-interface {v0, p0}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

    .line 123
    invoke-static {}, Lcom/openfeint/internal/OpenFeintInternal;->getInstance()Lcom/openfeint/internal/OpenFeintInternal;

    move-result-object v0

    invoke-virtual {v0}, Lcom/openfeint/internal/OpenFeintInternal;->getAnalytics()Lcom/openfeint/internal/Analytics;

    move-result-object v0

    invoke-virtual {v0}, Lcom/openfeint/internal/Analytics;->markDashboardClose()V

    .line 124
    return-void
.end method

.method public onOptionsItemSelected(Landroid/view/MenuItem;)Z
    .locals 5
    .parameter "item"

    .prologue
    const/4 v4, 0x1

    .line 151
    const/4 v0, 0x0

    .line 153
    .local v0, menuButtonName:Ljava/lang/String;
    invoke-interface {p1}, Landroid/view/MenuItem;->getItemId()I

    move-result v1

    const v2, 0x7f080017

    if-ne v1, v2, :cond_1

    .line 154
    const-string v0, "home"

    .line 155
    iput-boolean v4, p0, Lcom/openfeint/api/ui/Dashboard;->mRootIsHome:Z

    .line 162
    :cond_0
    :goto_0
    if-nez v0, :cond_3

    invoke-super {p0, p1}, Lcom/openfeint/internal/ui/WebNav;->onOptionsItemSelected(Landroid/view/MenuItem;)Z

    move-result v1

    .line 165
    :goto_1
    return v1

    .line 156
    :cond_1
    invoke-interface {p1}, Landroid/view/MenuItem;->getItemId()I

    move-result v1

    const v2, 0x7f080018

    if-ne v1, v2, :cond_2

    .line 157
    const-string v0, "settings"

    goto :goto_0

    .line 158
    :cond_2
    invoke-interface {p1}, Landroid/view/MenuItem;->getItemId()I

    move-result v1

    const v2, 0x7f080019

    if-ne v1, v2, :cond_0

    .line 159
    const-string v0, "exit"

    goto :goto_0

    .line 164
    :cond_3
    const-string v1, "OF.menu(\'%s\')"

    new-array v2, v4, [Ljava/lang/Object;

    const/4 v3, 0x0

    aput-object v0, v2, v3

    invoke-static {v1, v2}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, v1}, Lcom/openfeint/api/ui/Dashboard;->executeJavascript(Ljava/lang/String;)V

    move v1, v4

    .line 165
    goto :goto_1
.end method

.method public onPrepareOptionsMenu(Landroid/view/Menu;)Z
    .locals 3
    .parameter "menu"

    .prologue
    const/4 v2, 0x1

    .line 140
    const v0, 0x7f080017

    invoke-interface {p1, v0}, Landroid/view/Menu;->findItem(I)Landroid/view/MenuItem;

    move-result-object v0

    iget-boolean v1, p0, Lcom/openfeint/api/ui/Dashboard;->mRootIsHome:Z

    if-eqz v1, :cond_0

    iget v1, p0, Lcom/openfeint/api/ui/Dashboard;->pageStackCount:I

    if-gt v1, v2, :cond_0

    const/4 v1, 0x0

    :goto_0
    invoke-interface {v0, v1}, Landroid/view/MenuItem;->setVisible(Z)Landroid/view/MenuItem;

    .line 141
    return v2

    :cond_0
    move v1, v2

    .line 140
    goto :goto_0
.end method

.method public onResume()V
    .locals 1

    .prologue
    .line 114
    invoke-super {p0}, Lcom/openfeint/internal/ui/WebNav;->onResume()V

    .line 115
    sget-object v0, Lcom/openfeint/api/ui/Dashboard;->sOpenDashboards:Ljava/util/List;

    invoke-interface {v0, p0}, Ljava/util/List;->contains(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_0

    sget-object v0, Lcom/openfeint/api/ui/Dashboard;->sOpenDashboards:Ljava/util/List;

    invoke-interface {v0, p0}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 116
    :cond_0
    invoke-static {}, Lcom/openfeint/internal/OpenFeintInternal;->getInstance()Lcom/openfeint/internal/OpenFeintInternal;

    move-result-object v0

    invoke-virtual {v0}, Lcom/openfeint/internal/OpenFeintInternal;->getCurrentUser()Lcom/openfeint/api/resource/CurrentUser;

    move-result-object v0

    if-nez v0, :cond_1

    invoke-virtual {p0}, Lcom/openfeint/api/ui/Dashboard;->finish()V

    .line 117
    :cond_1
    return-void
.end method
